package com.ruoyi.postResponse.service.impl;

import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.ruoyi.postResponse.mapper.PostResponseMapper;
import com.ruoyi.postResponse.domain.PostResponse;
import com.ruoyi.postResponse.service.IPostResponseService;
import com.ruoyi.common.core.text.Convert;

/**
 * 帖子回复 服务层实现
 * 
 * @author ruoyi
 * @date 2019-10-15
 */
@Service
public class PostResponseServiceImpl implements IPostResponseService 
{
	@Autowired
	private PostResponseMapper postResponseMapper;

	/**
     * 查询帖子回复信息
     * 
     * @param id 帖子回复ID
     * @return 帖子回复信息
     */
    @Override
	public PostResponse selectPostResponseById(Integer id)
	{
	    return postResponseMapper.selectPostResponseById(id);
	}
	
	/**
     * 查询帖子回复列表
     * 
     * @param postResponse 帖子回复信息
     * @return 帖子回复集合
     */
	@Override
	public List<PostResponse> selectPostResponseList(PostResponse postResponse)
	{
	    return postResponseMapper.selectPostResponseList(postResponse);
	}
	
    /**
     * 新增帖子回复
     * 
     * @param postResponse 帖子回复信息
     * @return 结果
     */
	@Override
	public int insertPostResponse(PostResponse postResponse)
	{
	    return postResponseMapper.insertPostResponse(postResponse);
	}
	
	/**
     * 修改帖子回复
     * 
     * @param postResponse 帖子回复信息
     * @return 结果
     */
	@Override
	public int updatePostResponse(PostResponse postResponse)
	{
	    return postResponseMapper.updatePostResponse(postResponse);
	}

	/**
     * 删除帖子回复对象
     * 
     * @param ids 需要删除的数据ID
     * @return 结果
     */
	@Override
	public int deletePostResponseByIds(String ids)
	{
		return postResponseMapper.deletePostResponseByIds(Convert.toStrArray(ids));
	}

	public int updateResponseToComments(@Param("commentId") Integer commentId){
		return postResponseMapper.updateResponseToComments(commentId);
	};
	
}
